<?php
class Cms_View_Helper_VideoThumb
{
    public $view;

    public function videoThumb($value, $id , $vtype)
    {
    	$CONFIG = Zend_Registry::get('config');
    	
    	$image =  '../' . $CONFIG->path->cast->thumbnail .  $value;
    	list($src_width, $src_height, $imagetype, $attr) = getimagesize($image );
    	
    	$max_width  = '150';
		$max_height = '115';
		if ( $src_width / $src_height > $max_width / $max_height ) {
			$thumb_w = $max_width;
			$thumb_h = $src_height * $max_width / $src_width;
		}
		else {
			$thumb_w = $src_width * $max_height / $src_height;
			$thumb_h = $max_height;
		}
		$padding_top = (115-$thumb_h)/2;
										
		echo '<div style="width:150px;height:115px;background-color:black;padding:0; float:left;margin-right:20px">';
		if($vtype == 'Vcasmo') {
			echo "<a href='/premium_read.php?id=" . base64_encode($id) . "' class='Tags12' style='cursor:pointer;'>";			
		}else {
			echo "<a href='/vcast_read.php?id=" . base64_encode($id) . "' class='Tags12' style='cursor:pointer;'>";						
		}
		echo '<img src="' . $image . '"  border="0" width="150" style="margin:0;margin-top:' . $padding_top . 'px"/>	</a>';																
		echo '</div>';
														
    }

    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }
}